package com.zzyl.nursing.controller.member;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.R;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.nursing.domain.NursingProject;
import com.zzyl.nursing.dto.member.MemberProjectDto;
import com.zzyl.nursing.service.INursingProjectService;
import com.zzyl.nursing.vo.member.MemberGetProjectByIdVo;
import com.zzyl.nursing.vo.member.MemberProjectPageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/member/orders")
public class MemberOrderController extends BaseController {
    @Autowired
    private INursingProjectService nursingProjectService;

    @GetMapping("/project/page")
    public MemberProjectPageResult<NursingProject> getPageList(MemberProjectDto dto){

        List<NursingProject> list = nursingProjectService.MemberOrderPageList(dto);
        PageInfo<NursingProject> pageInfo = new PageInfo<>(list);
        return new MemberProjectPageResult<>(pageInfo.getTotal(), pageInfo.getList());
    }

    @GetMapping("/project/{id}")
    public MemberGetProjectByIdVo getProjectById(@PathVariable Long id){
        NursingProject project = nursingProjectService.selectNursingProjectById(id);
        MemberGetProjectByIdVo result = new MemberGetProjectByIdVo(project);
        return result;
    }


}
